Skip to content

fix(service-knowledge): search refills after the permission filter; a hit's title is the object's display field - #37301

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-u4piwu
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-u4piwu

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #36993
Fixes #36994

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在挂了知识库的应用里,一个人能看的记录很少时,AI 检索不再返回空或只剩一两条,而是继续往后找,补满到要的条数;命中结果的标题改为取对象的名称字段(比如客户的「名称」、发票的编号),不再只认名为 title 的字段。
  • 为什么做:知识检索平台化专题的第一、四阶段两张卡,同一个文件一起修;「按记录返回」那张卡要在这次的补齐逻辑上继续做。
  • 出错会怎样:最坏是检索多读一轮、稍慢,或某条命中没有标题。权限检查只多不少:名称字段对某人不可查时,这个知识源对他不检索;旧索引里的标题还取自名为 title 的字段,所以在索引重建之前,title 字段对某人不可查时同样不检索。可以直接撤回。
  • 要你做的:无。

What changes

Search refills after the permission filter (#36993). KnowledgeService.search re-checks every object-source hit as the caller after ranking, so a caller who may read few of the matching rows was answered from what was left of topK ranked hits. Now:

  • When the re-check can remove hits (a caller who is not the system identity, with a data engine bound), each object source is asked for topK × SEARCH_FIRST_ROUND_FACTOR (5).
  • When the survivors name fewer than topK records (several passages of one record count once: an object hit is its source and record id, any other hit its document), every object source that answered as many hits as it was asked (the only ones that may hold more) is asked once more, for topK × SEARCH_REFILL_FACTOR (20, the cap). That round's answer replaces the source's first-round hits; a source whose refill throws keeps its first-round survivors. At most two rounds; an adapter that caps topK answers fewer than asked and is never asked again.
  • A file / http source is asked for topK once (the re-check never removes its hits). The system identity gets one round of topK, no refill. No context: object sources stay unsearched, as before (fail closed).
  • The answer is still at most topK chunk-level hits, sorted by score; search's return type is unchanged (expectTypeOf pin). The count the re-check removed is logged at debug only, never returned.
  • The adapter loop moved into a private searchRound, unchanged in behaviour (foreign-source hits dropped and warned, a throwing adapter logged and skipped).

A hit's title is the object's display field (#36994). recordToDocument read record.title. Per ADR-0161 K5 ("the title is the object's display field"), it now reads the field documentTitleField(schema) names: resolveDisplayField (ADR-0079: nameField, its deprecated alias, else the derivation), and with no object definition a field named title, as before. A withheld field (credential-class or internal), an empty value, a value that is not text or a finite number, a definition that resolves no display field, or a nameField the definition does not declare gives no title. resolveRecordDisplayName is not used: its Record #id floor is a UI label.

The source admission's field gate (servedFieldsOf) asks about the same field through the same documentTitleField. So a source whose object's display field the caller may not query is not searched for that caller at all. It also keeps asking about a declared field named title, as before: documents indexed under the earlier rule carry that field's value as their title and stay in the index until a complete reindex writes them again, and nothing reindexes at boot. That arm is retired once the index is proven rebuilt under the display-field rule (the recipe hash that names the title rule, ADR-0161 K7, and the rebuild of a stale source, #37099); the code comment says so.

Docs: content/docs/protocol/knowledge.mdx states the refill and its cap, and the display-field title (three places that said "the record title"); content/docs/ai/knowledge-rag.mdx says the same in two sentences. content/docs/permissions/system-context.mdx row 46 keys search too (it now reads isSystem: the system identity skips the over-fetch and the refill), and its generated register is regenerated (check:system-context-census --write).

Tests

packages/services/service-knowledge: pnpm test 8 files / 219 tests passed at 4621738; pnpm typecheck exit 0 (incl. check:test-typecheck). New pins in knowledge-service.test.ts (two top-level describes) and knowledge-source-admission.test.ts (one):

  • 100 hits, the caller may read 5 spread across them → those 5, best first; asked [s1, 25] then [s1, 100].
  • A readable row beyond the cap → fewer than topK, never a third round. Enough survivors → no refill. An adapter capping at 10 → asked once. Several sources → only the saturated one refilled. The refill decision counts records: topK 3, one source answers two passages of one readable record, another holds a readable record past its first round that outranks both → it is refilled and answers [s1-c0, s1-c15, s2-a]. A failed refill keeps round one. System identity → one round of topK, no re-check. No context → only the file source, asked topK. A file source beside an object source → asked topK once.
  • Removed count only in the debug log; answer and return type unchanged.
  • Title: explicit nameField; derived name over title; formula (text) and autonumber name fields (a number value → its text); withheld internal / secret name fields; empty, non-text, unresolvable and undeclared-nameField cases; no definition → title; the event sync and the reindex walk read the definition off the engine.
  • Field gate: hiding the display field refuses the source even with title visible; hiding a declared title that is not the display field refuses it too (the adapter returns a stored hit carrying an old-rule title, and the answer is empty); a caller who may query both gets the hit.
Ablations: each committed first, mutated through scripts/ablation-replace.mjs, restored to HEAD with git diff HEAD empty
  • Refill disabled (if (false && filtered && kept.length < topK)): 6 refill tests red, 5 green (the ones that pin "no refill").
  • Title back to record.title: 5 title tests red.
  • Field gate back to title only: both display-field gate tests red.
  • Refill decision back to counting hits (kept.length): the record-counting test red, 150 green.
  • The declared-title arm deleted from the gate: its refusal pin red, 24 green.

Acceptance notes

Verification

Files to read first: packages/services/service-knowledge/src/knowledge-service.ts (search, searchRound, documentTitle), knowledge-source-admission.ts (documentTitleField, servedFieldsOf).

Two-minute check: pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-service.test.ts -t refills — 11 tests pass; the first shows a caller reading 5 of 100 hits getting all 5.

Local gate families: the derived list (scripts/pm/dispatch-gates.mjs --commands, 98 commands, derived at ecb0842), run in order; CI runs the full farm

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1


Generated by Claude Code

…a hit's title is the object's display field

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
…nd the display-field title

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
…ay-field title; changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
…eindex constants

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-knowledge, touching 11 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/knowledge-rag.mdx (via KnowledgeService (symbol, a top-level class))
  • content/docs/protocol/knowledge.mdx (via KnowledgeService (symbol, a top-level class))
What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 9e6533bd484770298500ce4f03be2925d7986923 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6126d613bcfa1aa426ac5c99f4eacc989d6311ae — the merge of head 46217388a8d037b1dd6c6a51d4a067b6c3236030 into base 9e6533bd484770298500ce4f03be2925d7986923, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6126d613bcfa1aa426ac5c99f4eacc989d6311ae && git checkout 6126d613bcfa1aa426ac5c99f4eacc989d6311ae
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9e6533bd484770298500ce4f03be2925d7986923 46217388a8d037b1dd6c6a51d4a067b6c3236030 && git checkout -B drift-repro 9e6533bd484770298500ce4f03be2925d7986923 && git merge --no-ff 46217388a8d037b1dd6c6a51d4a067b6c3236030

node scripts/docs-audit/affected-docs.mjs --json 9e6533bd484770298500ce4f03be2925d7986923

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 9e6533bd484770298500ce4f03be2925d7986923 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…isplay-field title

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U

席位核对

Verdict: REWORK
Head-sha: 2b95b310f274e801312523b76fe77db2afe8f2c7

L1 reviewer of record for PR #37301 (folded cards #36993 and #36994, epic #37000). Read against GitHub and the PR's committed tree, not against the report.

Checklist conclusions

Spot-check readings

Setup:

  • Fetch: git fetch origin pull/37301/head:refs/l1/37301 main gives 2b95b310f274…. The PR API head.sha is the same value.

  • Diff: git diff origin/main...refs/l1/37301 changes 8 files (+448/−29).

  • node scripts/pm/l1-face.mjs --pr 37301 first failed with ERR_MODULE_NOT_FOUND: yaml. pnpm install --frozen-lockfile --filter ./scripts... matched no project (scripts/ is not a workspace member), so I installed the root's own deps with pnpm install --frozen-lockfile --filter . --ignore-scripts. l1-face then ran: INCOMPLETE (all-checks pending), with the one flag discussed under Form.

  • Local run: in a fresh detached worktree at the head, pnpm install --frozen-lockfile --filter "@objectstack/service-knowledge..." and OS_SKIP_DTS=1 pnpm --filter "@objectstack/service-knowledge^..." build, then npx vitest run in packages/services/service-knowledge: 8 files / 217 tests passed. This matches the report.

  • R1. Refill mechanics (packages/services/service-knowledge/src/knowledge-service.ts):

    • :558: the over-fetch is gated by ctx !== undefined && ctx.isSystem !== true && dataEngine !== undefined.
    • :566: one refill block, so there is no third round by construction.
    • :569: only a source whose answered >= firstAsk(source) is refilled, so an adapter that caps topK is never asked again.
    • :580: the removed count is re-based for the refilled sources.
    • :585: the count goes only to logger.debug.
    • :591: kept.slice(0, topK), so search still returns Promise<KnowledgeHit[]>.
    • No context: admitSources (:861 onward) keeps only non-object sources. This is unchanged and is pinned by the test no context: … asked topK once ([['f1', 5]]).
  • R2. Ablations reproduced (sed mutation, run, git checkout -- src, git diff --quiet HEAD):

    Mutation Result
    (A) refill disabled (if (false && …)) 6 red, the 6 the PR names
    (B) saturation check replaced by true an adapter that caps topK … not asked again and several sources … go red, plus 6 older tests
    (C) title back to record.title 5 red
    (D) field gate back to 'title' 2 red
    (E) filtered ignores isSystem the system identity: one round of topK … goes red

    Each claimed "red without the fix" holds.

  • R3. Return type: expectTypeOf(svc.search).returns.toEqualTypeOf<Promise<KnowledgeHit[]>>() sits in knowledge-service.test.ts. tsconfig.test.json includes src/**/*, so check:test-typecheck compiles it. Removed count: the removed 99 hit(s) debug assertion plus out deep-equal to the single raw hit show nothing else rides on the answer. This satisfies the epic ruling "The count of hits removed by the permission filter is never returned to the caller" and ADR-0161 K9 rule 6.

  • R4. Title (knowledge-service.ts:1371 documentTitle, :1447; knowledge-source-admission.ts:163 documentTitleField):

    • The title comes from resolveDisplayField (nameField, then displayNameField, then the derivation).
    • A withheld, empty or non-text value gives undefined. A finite number is converted with String().
    • No definition reads 'title'.
    • resolveRecordDisplayName is not called.

    All three What items and all three Acceptance cases of service-knowledge: a knowledge hit's title is read from a hard-coded title field #36994 are covered.

  • R5. Card service-knowledge: search returns a short page after the permission filter instead of refilling #36993 point 2: the deviation's reason is falsified for several sources.

    • The PR's Acceptance note says a refill decided by distinct records "changes no answer". That holds for one source only.
    • Probe (test file written in the worktree, then deleted): topK 3. s1 holds 100 ranked hits, and the caller may read rec_0 and rec_15 (rec_15 is outside round one's 15). s2 answers 2 chunks of one readable record, scoring 0.5 and 0.49.
    • At head, the answer is ["s1:rec_0@1","s2:r@0.5","s2:r@0.49"] with no refill.
    • With :566 changed to count distinct sourceId#sourceRecordId, the answer is ["s1:rec_0@1","s1:rec_15@0.985","s2:r@0.5"], and all 149 tests of the two touched suites stay green.
    • The cut half of the reason does hold: KnowledgeSearchOptions.topK is "Max number of hits to return" (packages/spec/src/contracts/knowledge-service.ts:32), and search_knowledge returns "at most topK" passages (knowledge-tools.ts:85). So the answer must stay at most topK chunk hits. That matches the card's own words, "what is returned stays chunk-level hits".
    • Point 2 can therefore only mean the refill decision, and there it changes answers. service-knowledge: search returns records, not chunks — granularity and groupBy #37103 does not own it: its item 2 counts groups in record mode, and chunk mode stays "today's behaviour".
    • Verdict: an unaccepted deviation from a maintainer card's What item. The card's Acceptance also lists "several sources".
  • R6. Field gate: the head narrows a check that documents already in the index still need.

    • main (knowledge-source-admission.ts:222 at origin/main) checked title whenever the object declares it; the head (:262–263) checks only the display field.
    • Documents indexed under the old title rule stay in a persistent index until a complete reindex rewrites them, and nothing reindexes at boot (service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099 is open). The old check must stay until then; details went to the card thread.
    • The report's security_findings line and the maintainer summary's 「权限只会更严」 need correcting at this head.
  • R7. Point 2 of the brief (whole source not searched): this is what the code does. servedFieldsOf adds the display field, and admitSourceFields refuses the source. The test refusal: a caller who may not query the display field gets no hit asserts searched() == []. This is within the cards, not scope creep:

    It fails closed and is justified. The only defect is the dropped legacy title arm (R6). The other knowledge-source-admission.ts changes are within the cards: the header TSDoc, the documentTitleField export (internal, not in index.ts) and servedFieldsOf.

  • R8. Overlap with feat(service-knowledge)!: one splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key; KnowledgeChunk.metadata and knowledge.chunk_overlap retired #37287: node scripts/pm/overlap-check.mjs --branch=refs/l1/37301 --pr=37287 gives ✓ origin/main: merges cleanly, ✓ #37287: merges cleanly, VERDICT clean exit 0 (feat(service-knowledge)!: one splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key; KnowledgeChunk.metadata and knowledge.chunk_overlap retired #37287 head c84c242a).

  • R9. Docs and changeset, read sentence by sentence against the diff:

    • content/docs/protocol/knowledge.mdx §3.2: the five refill sentences match :558–591. The title paragraph matches R4. The three replaced "record title" sentences (source admission intro, field-level rules bullet, event-sync bullet) match the code.
    • :190: "a caller who may read fewer matching rows than survive within it" is garbled (fix 4). The same wording is in the SEARCH_REFILL_FACTOR TSDoc at knowledge-service.ts:1174–1180.
    • content/docs/ai/knowledge-rag.mdx:51–56: "asks each object source for more hits than topK" omits the system identity. "the record's display name" conflates the title with resolveRecordDisplayName, which has a Record #id floor, and "(nameField)" omits the derivation (fix 4).
    • content/docs/permissions/system-context.mdx row 46 and the register line knowledge-service.ts#search | 1 | 46 match :558.
    • Changeset bullets 1 and 3 match the code. Bullet 2's last sentence says only that the caller "is not served it as a title", while the code refuses the whole source (fix 3).
  • Report evidence: commands and counts are real and pinned to the head. The local gates the report marks NOT MEASURED are covered by CI check-runs. I found no git-answerable API reads in the report.

Fix list (same claim, patch round to the original dev)

  1. (HIGH: R6) Keep the field gate asking about title when the object declares it, alongside documentTitleField(schema), for as long as the index may hold documents assembled under the old rule. A union in servedFieldsOf fails closed.
    • Replace the test preservation: hiding a \title` field that is not the display field does not refuse the sourcewith a refusal pin. The adapter in that pin returns a stored hit carrying an old-ruletitle`, and the test is red on the current head.
    • Write the retirement condition in the code comment and the PR body: the index is proven rebuilt under the new title rule (ADR-0161 K7 recipe hash, service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099).
    • Correct the report's security_findings line.
    • Another fail-closed design is acceptable if it comes with the same red-then-green pin.
  2. (Card service-knowledge: search returns a short page after the permission filter instead of refilling #36993 point 2: R5) Count survivors toward topK by distinct record in the refill decision (knowledge-service.ts:566). The key is sourceId plus sourceRecordId for object hits and documentId for file or http hits. The answer stays at most topK chunk-level hits.
    • Add the several-sources case from R5 as a test that is red without the change.
    • Rewrite the Acceptance note to match.
    • If the dev still holds the item should not be applied, the question goes to the card owner. It cannot close by Fixes on the current reasoning.
  3. Changeset: say that a caller who may not query the object's display field does not have the source searched at all. With fix 1, also say that a declared title field still gates the source until the index is rebuilt.
  4. Docs and TSDoc wording (R9):
    • Rewrite knowledge.mdx:190 and the SEARCH_REFILL_FACTOR TSDoc as "a caller who may read fewer than topK of the rows within the cap gets fewer than topK hits".
    • In knowledge-rag.mdx, say the over-ask is for a caller other than the system identity.
    • In knowledge-rag.mdx, replace "the record's display name … (nameField)" with "the value of the object's display field (nameField, else the derived title field)".
  5. PR body: correct the maintainer summary's 「权限只会更严」 to match what fix 1 makes true. Update the Acceptance notes for fixes 1 and 2. Re-run scripts/pm/overlap-check.mjs against feat(service-knowledge)!: one splitter (whole / recursive / markdown, Chinese-aware), the chunk channel and the split key; KnowledgeChunk.metadata and knowledge.chunk_overlap retired #37287 before the push.

Seat-side item, not the dev's: revise the claim's file surface on #36993 to include content/docs/ai/knowledge-rag.mdx and content/docs/permissions/system-context.mdx.

L2 verdict

Not owed. Governing text, references/contract-review.md 〈L2 归属与资格〉:

L2 面 = 契约四面:Clause-②: yes 申报、收窄申报、已发布 schema(packages/spec/src/** 非测试)、governed 规则文本 … .changeset/CHANGELOG、content/docs/**、apps/docs/** 散文面 ⛔ 不在其列。

四面皆不碰 ⇒ CI 加席位自读 ⛔ 不起第二个 agent。

How each face reads:

  • The PR body and the changeset both declare Clause-②: no, and that holds (R9 and the Changeset line).
  • No (narrowing) arm.
  • No file under packages/spec/src/**.
  • No governed path. Checked against .github/CODEOWNERS Tier H, and Governed Surface Queue Guard is success.

The fixes above do not add a face. Re-check the faces on the next head.

…d title still gates the source until the index is rebuilt

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
…tes the source; wording

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWqwmAwx7eD4Xf3dv1
@github-actions github-actions Bot added size/l and removed size/m labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U

席位核对 (round 2)

Verdict: ACCEPT
Head-sha: 46217388a8d037b1dd6c6a51d4a067b6c3236030

L1 reviewer of record. This round reads the delta from 2b95b310 to 46217388 (2 commits, fast-forward, 7 files, +81/−26) against the five round-1 fix items. The reading comes from the fetched PR tree and GitHub, not from re-report 7165845829.

Setup: git fetch origin pull/37301/head gives 46217388a8d0…, and the PR API head.sha matches. In a fresh worktree at that head I installed the package's dependency closure (pnpm install --frozen-lockfile --filter "@objectstack/service-knowledge...") and built it (OS_SKIP_DTS=1 pnpm --filter "@objectstack/service-knowledge^..." build). npx vitest run in packages/services/service-knowledge then gave 8 files / 219 tests passed, which matches the re-report.

Fix items

  1. Field gate keeps asking about a declared title field: done.
    • knowledge-source-admission.ts servedFieldsOf adds documentTitleField(schema) and still adds title whenever the object declares it or its fields cannot be enumerated. That is main's line unchanged, so the served set at this head contains main's served set.
    • The retirement condition (ADR-0161 K7 recipe hash, service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099) is in the code comment, the module TSDoc and the PR body's Acceptance notes.
    • The pin refusal: a declared \title` the caller may not query still refuses the source — a stored hit may carry its valuehas the adapter return a stored hit with an earlier-rule title, and asserts[]` and that the source is not searched.
    • Ablation: deleting the arm turns that pin red (1 failed / 150 passed across the two suites), and restoring it gives a clean git diff HEAD.
    • The round-1 probe re-run at this head answers [], the same as main.
  2. Refill decision counts records: done.
    • knowledge-service.ts search now refills when distinctRecords(kept) < topK. distinctRecords keys an object hit by sourceId#sourceRecordId and any other hit by its documentId.
    • The answer is still kept.slice(0, topK) chunk-level hits, so the topK contract ("Max number of hits to return") holds.
    • New pin: topK 3 over sources s1 and s2 answers ['s1-c0','s1-c15','s2-a'], with calls [['s1',15],['s2',15],['s1',60]].
    • Ablation: going back to kept.length turns that pin red (1 failed / 150 passed). Disabling the refill turns 7 red, the 6 from round 1 plus the new pin.
    • The round-1 several-sources probe at this head answers ["s1:rec_0@1","s1:rec_15@0.985","s2:r@0.5"].
    • The Acceptance note now says the count changes the answer when there are several sources, and that the cut stays at chunk level.
    • Card service-knowledge: search returns a short page after the permission filter instead of refilling #36993 point 2 is delivered, so Fixes #36993 is now correct.
  3. Changeset: done. I checked each changed sentence against the code:
    • Bullet 1 now says "name fewer than topK records (several passages of one record count once)", which matches distinctRecords.
    • Bullet 2 now says a source whose display field the caller may not query "is not searched for that caller at all", and that a declared title still gates the source until a complete reindex. Both match servedFieldsOf.
    • '@objectstack/service-knowledge': patch, Clause-②: no and Metadata-protocol: none are unchanged and still hold.
  4. Docs and TSDoc wording: done. I read each changed sentence against the diff:
    • content/docs/protocol/knowledge.mdx §3.2: the refill now counts records, and the garbled cap sentence now reads "a caller who may read fewer than topK of the rows within the cap gets fewer than topK hits".
    • knowledge.mdx, the new title paragraph sentence and the field-level rules bullet (now "and a declared title field"): both match servedFieldsOf.
    • content/docs/ai/knowledge-rag.mdx: "for a caller other than the system identity" and "when too few records survive" are added, and "the value of the object's display field (nameField, else the derived title field)" replaces "the record's display name".
    • The SEARCH_REFILL_FACTOR TSDoc carries the same corrected sentence.
  5. PR body: done.
    • The maintainer summary now says permission checks only increase, which is true at this head (gate served set contains main's).
    • The Acceptance notes now cover the record-counting decision and the temporary declared-title arm. The Tests and Ablations sections list both new pins.
    • Closing keywords are Fixes #36993 and Fixes #36994 only, both folded cards and both delivered. No other open card number sits next to a closing keyword.

Other readings

Gate check-runs at 4621738 (CI had just started)

  • Complete and passing: TypeScript Type Check, Check Changeset, all four Type Check · jobs, plus 31 success and 17 expected skipped in total.
  • Lint & Repo Gates: no check-run yet, so NOT MEASURED.
  • In progress, NOT MEASURED: Build Docs, Lint · CI, release & engine gates, Lint · repo & tooling gates, Lint · scoped · slot lookup & corpus, Test Core 1/10 to 5/10.
  • No failures so far.

L2 verdict

Not owed. Governing text, references/contract-review.md 〈L2 归属与资格〉:

L2 面 = 契约四面:Clause-②: yes 申报、收窄申报、已发布 schema(packages/spec/src/** 非测试)、governed 规则文本 … .changeset/CHANGELOG、content/docs/**、apps/docs/** 散文面 ⛔ 不在其列。

四面皆不碰 ⇒ CI 加席位自读 ⛔ 不起第二个 agent。

The delta adds no face:

  • The declaration is still Clause-②: no. distinctRecords is module-private, and src/index.ts is unchanged.
  • No (narrowing) arm.
  • No packages/spec/src/** file.
  • No governed path.

Landing notes

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 15:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 039b288 Nov 25, 2026
60 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-u4piwu branch November 25, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants